#include <QApplication>
#include "login.h"
#include "mainproject.h"

int main(int argc, char *argv[])
{
    QApplication a(argc, argv);
    // 加载QSS文件
    QFile mainFile(":/qss/style.qss");
    if (mainFile.open(QFile::ReadOnly)) {
        QString styleSheet = QLatin1String(mainFile.readAll());
        a.setStyleSheet(styleSheet);
    }else{
        qDebug() <<"UserManger QSS打开失败";
    }

    Login *loginWindow = Login::getInstance();
    loginWindow->show();

    QObject::connect(loginWindow, &Login::loginSuccess, [&]() {
        MainProject *mainWindow = new MainProject();
        mainWindow->show();
        QObject::connect(mainWindow, &MainProject::destroyed, &a, &QApplication::quit);
    });

    return a.exec();
}
